/**
 * 设置”群发消息自动确认“
 */
import { Service } from '@gnlab/utils'
import type { Services } from '@/services'
import { API } from '@/services/common/api'

export class AutoConfirMassMessage extends Service<Services> {
  async get() {
    return API('/Config/GetConfig', {
      formatter(raw: { IsAutoConfirmMassMessage: boolean | null }) {
        return raw.IsAutoConfirmMassMessage === true
      },
    })
  }

  async save(enable: boolean) {
    return API('/Config/SaveIsAutoConfirmMassMessage', {
      data: { IsAutoConfirmMassMessage: enable },
    })
  }
}
